<script setup>
  import {useRouter} from 'vue-router'
  
  let router = useRouter()

  let username = window.sessionStorage.getItem('username')

  function lgout(){
    // 清除缓存
    window.sessionStorage.removeItem('username')
    // 返回登录页面
    router.push('/login')
  }
</script>

<template>
  <div>
    欢迎 {{ username }} 登录
    <button @click="lgout()">注销</button>
  </div>
</template>

<style scoped>
</style>
